<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Base Sprite</title>
</head>
<body>
  <canvas id="mycanvas" width="600" height="600"></canvas>
  <script src="/js/sprite-core.js"></script>
  <script>
    const Sprite = spritejs.Sprite;
    const Layer = spritejs.Layer;
    const context = document.getElementById('mycanvas').getContext('2d');
    const layer = new Layer({context, renderMode: 'repaintDirty'});

    const s = new Sprite({
      id: 'abc',
      anchor: 0.5,
      bgcolor: 'red',
      size: [500, 500],
      pos: [300, 300],
      zIndex: 0,
      border: [10, 'blue'],
      // gradients: {
      //   bgcolor: {
      //     // direction: 90,
      //     // rect: [0, 0, 100, 100],
      //     vector: [50, 50, 10, 70, 80, 100],
      //     colors: [{
      //       offset: 0,
      //       color: 'rgba(255,0,0,0.5)',
      //     }, {
      //       offset: 1,
      //       color: 'rgba(255,0,0,1)',
      //     }],
      //   },
      // },
    });
    layer.append(s);
  </script>
</body>
</html>